#include "Camera.h"
namespace sl
{
	
	Camera::Camera(void)
	{
	}

	Camera::~Camera(void)
	{
	}

	void Camera::SetViewport( u32 x, u32 y, u32 width, u32 height )
	{
		if ( !m_rViewport )
			m_rViewport = new Viewport();

		m_rViewport->set( x, y, width, height );
		
	}

	void Camera::SetViewport( sl::Viewport * pViewport )
	{
		if ( m_rViewport == pViewport )
			return;
		m_rViewport = pViewport;
	}

	void Camera::SetProjectionMatrix( const sl::Matrix4 & matrix )
	{
		m_mProjection.set( matrix );
	}	

	void Camera::SetProjectionMatrixAsOrho( double left, double right,double bottom, double top,double zNear, double zFar )
	{

	}

	void Camera::SetProjectionMatrixAsOrtho2D( double left, double right, double bottom, double top )
	{

	}

	void Camera::SetProjectionMatrixAsFrustum(	double left, double right,double bottom, double top,double zNear, double zFar )
	{

	}

	void Camera::SetProjectionMatrixAsProjective( double fov, double aspectRatio, double zNear, double zfar )
	{
		SetProjectionMatrix( sl::Matrix4::perspective( fov, aspectRatio, zNear, zfar ) );
	}

	// store the postion and camera coordinates
	void Camera::SetViewMatrix( const sl::Matrix4 & matrix )
	{
		m_mView.set( matrix );
	}

	void Camera::SetViewMatrixAsLookAt( const sl::Vector3 & eye, const  sl::Vector3 & center, const sl::Vector3 & up )
	{
		SetViewMatrix( sl::Matrix4::lookAt( eye, center, up ) );
	}
}
